// 封装角色相关的接口
import request from '@/utils/request'
import type { GetRoleListResponse ,AddOrUpdateRoleParams} from '@/types/permission/role'

// 获取全部角色列表
export const getAllRoleListAPI = (page: number, limit: number,roleName: string = '') => {
    return request.get<any,GetRoleListResponse>(`/admin/acl/role/${page}/${limit}?roleName=${roleName}`)
} 

// 添加角色
export const addRoleAPI = (data: AddOrUpdateRoleParams) => {
    return request.post<any,any>(`/admin/acl/role/save`,data)
}

// 更新角色
export const updateRoleAPI = (data: AddOrUpdateRoleParams) => {
    return request.put<any,any>(`/admin/acl/role/update`,data)
}

// 删除角色
export const deleteRoleAPI = (id: number) => {
    return request.delete<any,any>(`/admin/acl/role/remove/${id}`)
}